using System;

public class ProductVehicleSkin : Product
{
	public bool defaultSkin;

	public string targetId;

	public string skinTextureName;

	public override bool equippable
	{
		get
		{
			return true;
		}
	}

	public bool selected { get; set; }

	public ProductVehicleSkin(string id_G, MoneyType priceIng_G, int price_G, bool availableForBuy_G, float sortWeight_G, string texture_G, string nameForFlurry_G, bool isTemporary_G, int tier_G, bool bestPrice_G, bool newProduct_G, string nextProductId_G, string prevProductId_G, string categoryName_G, string subCategoryName_G, RareType rare_G, bool defaultSkin_G, string targetId_G, string skinTextureName_G)
		: base(id_G, priceIng_G, price_G, availableForBuy_G, sortWeight_G, texture_G, nameForFlurry_G, isTemporary_G, tier_G, bestPrice_G, newProduct_G, nextProductId_G, prevProductId_G, categoryName_G, subCategoryName_G, rare_G)
	{
		defaultSkin = defaultSkin_G;
		targetId = targetId_G;
		skinTextureName = skinTextureName_G;
	}

	protected override string GetEquipedKey()
	{
		return "vehicleSkin_" + targetId;
	}

	[Obsolete("Вызывать только из MarketController")]
	public override bool Equip()
	{
		Product equipedVehicleSkin = MarketController.Instance.GetEquipedVehicleSkin(targetId);
		if (equipedVehicleSkin != null)
		{
			equipedVehicleSkin.UnEquip();
		}
		if (base.Equip())
		{
			if (PrivateCarManager.instance != null && PrivateCarManager.instance.currentCar != null && PrivateCarManager.instance.currentCar.gameObject.name.Contains(targetId))
			{
				PrivateCarManager.instance.currentCar.ApplyCarUpgradesRPC(targetId);
			}
			if ((bool)MarketControllerUI.instance)
			{
				MarketControllerUI.instance.productsPanel.productInfoPanel.carUpsInfoPanel.UpdateSkins();
			}
			Product product = MarketController.Instance.GetProduct(targetId);
			if (equipedVehicleSkin != null && product.Purchased && Load.LoadString("car") != targetId)
			{
				MarketController.Instance.Equip(product);
			}
			return true;
		}
		return false;
	}

	[Obsolete("Вызывать только из MarketController")]
	public override bool UnEquip()
	{
		if (base.UnEquip())
		{
			return true;
		}
		return false;
	}
}
